package com.taikang.hmp.hbusiness.diabetes.measure.info.service.impl;

import java.util.List;

import com.taikang.framework.common.util.IDHelper;
import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.common.service.impl.BaseServiceImpl;
import com.taikang.hmp.hbusiness.diabetes.measure.info.service.IClickLikeService;

/** 
* @author qirp 
* @create date 2016年5月19日 下午3:31:06 
*/
public class ClickLikeServiceImpl extends BaseServiceImpl implements IClickLikeService{

	public String savelikeinfo(Dto paramDto) {
		Dto dto = new BaseDto();
		dto.put("id", IDHelper.genUUID());
		dto.put("customer_id", paramDto.getAsString("customerid"));
		dto.put("infoid", paramDto.getAsString("infoid"));
		dto.put("islike", paramDto.getAsString("islike"));
		super.getNewDao().insert("clicklike_space.savelikeinfo", dto);
		return "success";
	}

	public String cancelikeinfo(Dto paramDto) {
		Dto dto = new BaseDto();
		dto.put("customer_id", paramDto.getAsString("customerid"));
		dto.put("infoid", paramDto.getAsString("infoid"));
		dto.put("islike", paramDto.getAsString("islike"));
		super.getNewDao().update("clicklike_space.cancelikeinfo", dto);
		return "success";
	}

	public Dto getclickcount(Dto paramDto) {
		int count = (Integer)super.getNewDao().queryForObject("clicklike_space.getclickcount", paramDto.getAsString("infoid"));
		List<Dto> list = super.getNewDao().queryForList("clicklike_space.queryclickinfo", paramDto);
		Dto dto = new BaseDto();
		if(list.size() > 0){
			dto.put("count", count);
			dto.put("islike", list.get(0).getAsString("islike"));
		}else{
			dto.put("count", "0");
			dto.put("islike", "0");
		}
		return dto;
	}

}
